package com.tonann.quartz.task;

import com.tonann.app.service.IAppSensorService;
import com.tonann.app.task.DataCollectionTask;
import com.tonann.common.utils.StringUtils;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 定时任务调度测试
 *
 * @author ruoyi
 */
@Component("ryTask")
public class RyTask {

    @Resource
   private IAppSensorService sensorService;
    @Resource
    private DataCollectionTask dataCollectionTask;

    public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) {
        System.out.println(StringUtils.format("执行多参方法： 字符串类型{}，布尔类型{}，长整型{}，浮点型{}，整形{}", s, b, l, d, i));
        System.out.println("执行定时保存传感器值任务");
        sensorService.quartzSaveRecordValue();
    }

    public void ryParams(String params) {
        System.out.println("执行有参方法：" + params);
        dataCollectionTask.dataCollection();
    }

    public void ryNoParams()
    {
//        DeleteResult ret = mongoTemplate.remove(new Query(new Criteria()), "record");
//        assert ret.wasAcknowledged();
        System.out.println("执行定时更新传感器值任务");
         sensorService.quartzRecordValue();
    }

    public void rySensorRecordSave(){
        System.out.println("执行定时保存传感器值任务");
        sensorService.quartzSaveRecordValue();
    }
}
